<%--
  Created by IntelliJ IDEA.
  User: MSI-CN
  Date: 2021/4/1
  Time: 8:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<% if (session.getAttribute("userinfo")==null){
    response.sendRedirect("index.jsp");
}%>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="shortcut icon" href="../static/logo/projectIcon.ico"/>
    <title>礼金管理系统</title>
    <link rel="stylesheet" href="../static/layui/css/layui.css">

    <style>

        /*.layui-body {
            padding-bottom: 0 !important;
        }*/

        /*.layui-table-fixed .layui-table-body {
            height: auto!important;
        }
        .layui-table-fixed.layui-hide {
            display: block!important;
        }*/

        .layui-body {
            padding-bottom : 0px !important;
        }
    </style>
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo"></div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img id="u_img" src="" class="layui-nav-img">
                    <span id="username"></span>
                </a>
                <dl class="layui-nav-child">
                    <dd><a id="userInfo" href="javascript:void(0);">基本资料</a></dd>
                    <dd><a id="userSetting" href="javascript:void(0);">安全设置</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a id="LoginOut" href="javascript:void(0);">退出</a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed layui-this">
                    <a id="home" href="javascript:;">主页</a>
                </li>

                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;">宴会管理</a>
                    <dl class="layui-nav-child">
                        <dd><a id="iatt" href="javascript:;">我参加的</a></dd>
                        <dd><a id="ihold" href="javascript:;">我举办的</a></dd>
                        <dd><a id="attendpeople" href="javascript:;">添加参会人</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item layui-nav-itemed">
                    <a href="javascript:;">礼金管理</a>
                    <dl class="layui-nav-child">
                        <dd><a id="giftMore" href="javascript:;">礼金明细</a></dd>
                        <dd><a id="giftAnalysis" href="javascript:;">礼金分析</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="tencent://message/?uin=344497521&Site=http://vps.shuidazhe.com&Menu=yes">联系我们</a>
                </li>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div style="padding: 0px;">
        <%--默认进入home.jsp--%>
            <iframe src="forward?opr=home" width="100%" height="100%" scrolling="no" frameborder="0"></iframe>
        </div>
    </div>
</div>


<script src="../static/bootstrap-dist/js/jquery-3.5.1.js"></script>
<script src="../static/layui/layui.js"></script>
<script src="../static/bootstrap-dist/js/popper.min.js"></script>
<script src="../static/bootstrap-dist/js/bootstrap.js"></script>
<script>
    //JavaScript代码区域
    layui.use(['element','layer'], function(){
        let element = layui.element;
        let layer = layui.layer;

        $("#userInfo").click(function (){
            let index = layer.open({
                type: 2,
                content: ['forward?opr=userInfo','no'], //这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: ['http://sentsin.com', 'no']
                area : ['1000','500'],
                maxmin: true,
                title : '个人信息'
            });
        })

        $("#userSetting").click(function (){
            let index = layer.open({
                type: 2,
                content: ['forward?opr=updatePwd','no'], //这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: ['http://sentsin.com', 'no']
                area : ['1000','400'],
                maxmin: true,
                title : '修改密码'
            });
        })
    });

    let userName = ${sessionScope.userinfo};

    $("#username").text(userName.username)
    $("#u_img").attr("src",userName.userImg);

    $("#iatt").click(function (){
        $("iframe").attr("src","forward?opr=myAttend");
    })

    $("#attendpeople").click(function (){
        $("iframe").attr("src","forward?opr=attendpeople");
    })

    $("#addfeast").click(function (){
        $("iframe").attr("src","forward?opr=addfeast");
    })

    $("#home").click(function (){
        $("iframe").attr("src","forward?opr=home");
    })

    $("#ihold").click(function (){
        $("iframe").attr("src","forward?opr=feastList");
    })

    $("#giftMore").click(function (){
        $("iframe").attr("src","forward?opr=giftMore");
    })

    $("#giftAnalysis").click(function (){
        $("iframe").attr("src","forward?opr=giftAnalysis");
    })

    $("#LoginOut").click(function (){
        $.ajax({
            url : "user",
            method : "post",
            data : {
                "opr" : "logout"
            },
            dataType : "json",
            success : function (data){
                layer.msg('退出成功....');
                setTimeout(function () {
                    location.href = "index.jsp";
                },1000);
            },
            error : function (XMLHttpRequest, textStatus, errorThrown) {
                alert(errorThrown);
            }
        })
    });
</script>
</body>
</html>
